<template>
    <div class="box1">
        <div class="title">
            <p> 男女比例</p>
            <img src="../../images/dataScreen-title.png" alt="">
        </div>

        <div class="sex">
            <div class="man">
                <img src="../../images/man.png" alt="">
            </div>

            <div class="woman">
                <img src="../../images/woman.png" alt="">
            </div>
        </div>

        <div class="rate">
            <p>男生58%</p>
            <p>男生42%</p>
        </div>

        <div class="charts" ref="charts">

        </div>
    </div>
</template>

<script setup lang='ts' name='Sex'>
import * as echarts from 'echarts';
import { onMounted, ref } from 'vue';

let charts = ref();

onMounted(() => {
    let mycharts = echarts.init(charts.value)
    mycharts.setOption({
        title: {
            text: '男女比例',
            textStyle: {
                color: 'skyblue',
            },
            left: '40%'
        },
        xAxis: {
            show: false,
            main: 0,
            max: 100
        },
        yAxis: {
            type: 'category',
            show: false
        },
        series: [{
            type: 'bar',
            data: [58],
            barWidth: 20,
            z: 100,
            itemStyle: {
                color: 'pink',
                borderRadius: 20,
            }

        }, {
            type: 'bar',
            data: [100],
            barWidth: 20,
            barGap: '-100%',
            itemStyle: {
                color: 'pink',
                borderRadius: 20,
            }
        }],
        grid: {
            left: 0,
            right: 0,
            top: 0,
            bottom: 0,

        },
    })
})

</script>

<style scoped lang='scss'>
.box1 {
    width: 100%;
    height: 100%;
    background: url('../../images/dataScreen-main-cb.png') no-repeat;
    background-size: 100% 100%;
    margin: 20px 0;

    .title {
        margin-left: 20px;

        p {
            color: white;
            font-size: 20px;
        }
    }

    .sex {
        display: flex;
        justify-content: center;

        .man {
            margin: 20px;
            background: url('../../images/man-bg.png') no-repeat;
            width: 111px;
            height: 115px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .woman {
            margin: 20px;
            background: url('../../images/woman-bg.png') no-repeat;
            width: 111px;
            height: 115px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
    }

    .rate {
        display: flex;
        justify-content: space-between;

        p {
            color: white;
        }
    }

    .charts {
        height: 120px;
    }
}
</style>